<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateInboundShipment extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $sql = 'CREATE TABLE `fba_inbound_shipment` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ShipmentId` char(12) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT \'入库单编号\',
  `ShipmentName` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT \'入库单名称\',
  `ShipFromAddress` text COLLATE utf8mb4_unicode_ci COMMENT \'发货地址\',
  `ShipToAddress` text COLLATE utf8mb4_unicode_ci COMMENT \'收货地址\',
  `DestinationFulfillmentCenterId` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `LabelPrepType` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT \'贴标类型\',
  `ShipmentStatus` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT \'入库单状态\',
  `AreCasesRequired` tinyint(1) unsigned NOT NULL DEFAULT \'0\' COMMENT \'是否外箱包装\',
  `step` tinyint(1) unsigned NOT NULL DEFAULT \'1\',
  `status` tinyint(4) NOT NULL DEFAULT \'0\',
  `type` tinyint(4) NOT NULL DEFAULT \'0\',
  `warehouse_from` smallint(5) unsigned NOT NULL DEFAULT \'0\' COMMENT \'发出仓库\',
  `warehouse_to` smallint(5) unsigned NOT NULL,
  `wms_order_id` int(10) unsigned DEFAULT NULL,
  `ec_id` tinyint(4) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `remark` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`ShipmentId`),
  UNIQUE KEY `wms_order_id` (`wms_order_id`),
  KEY `name` (`ShipmentName`),
  KEY `status` (`ShipmentStatus`),
  KEY `ec_id` (`ec_id`),
  KEY `created_at` (`created_at`),
  KEY `updated_at` (`updated_at`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;';
        \DB::statement($sql);



        $sql = 'CREATE TABLE `fba_inbound_shipment_item` (
  `ShipmentId` char(12) COLLATE utf8mb4_unicode_ci NOT NULL,
  `SellerSKU` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT \'SKU\',
  `FulfillmentNetworkSKU` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT \'FNSKU\',
  `QuantityShipped` smallint(5) unsigned NOT NULL COMMENT \'发货箱数\',
  `QuantityInCase` tinyint(3) unsigned NOT NULL DEFAULT \'0\' COMMENT \'发货箱数\',
  `product_id` int(10) unsigned NOT NULL,
  UNIQUE KEY `ShipmentId` (`ShipmentId`,`product_id`),
  KEY `SellerSKU` (`SellerSKU`),
  KEY `product_id` (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;';
        \DB::statement($sql);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {

    }
}
